package cn.org.timespace.easyframe.service.permission.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.org.timespace.easyframe.dao.permission.EfControlPointDAO;
import cn.org.timespace.easyframe.model.permission.EfControlPoint;
import cn.org.timespace.easyframe.service.permission.EfControlPointService;

/**
 * <p>
 * 控制点
 * </p>
 * 
 * @version 1.0, 11/02/27
 * @since 1.0
 * @author wubo
 */

public class EfControlPointServiceImpl implements EfControlPointService {

	EfControlPointDAO efControlPointDao;

	public List<EfControlPoint> findAll() {
		return efControlPointDao.findAll();
	}

	public List<EfControlPoint> findAllByValid(String dicIsValid) {
		return efControlPointDao.findAllByIsValid(dicIsValid);
	}

	public EfControlPointDAO getEfControlPointDao() {
		return efControlPointDao;
	}

	public void setEfControlPointDao(EfControlPointDAO efControlPointDao) {
		this.efControlPointDao = efControlPointDao;
	}
	
	public List<EfControlPoint> findListByUserId(String userId){
		return this.efControlPointDao.findByUserId(userId);
	}
	
	public Map<String,String> findMapByUserId(String userId){
		Map<String,String> resMap = new HashMap<String, String>();
		
		List<EfControlPoint> resList = this.efControlPointDao.findByUserId(userId);
		if(resList != null && resList.size() > 0)
		{
			for(EfControlPoint cp : resList)
			{
				resMap.put(cp.getControlPointCode(), cp.getControlPointName());
			}
		}
		
		return resMap;
	}
}